#include "main.h"
#include "IR.h"
#include "rfid.h"
#include "usart.h"
#include "IR.h"
#include "sr04.h"
#include "control.h"

extern _Bool stopFlag;
extern _Bool rfidFlag;
extern Stuff stuff[];
extern Stuff currentStuff;
extern float distant;
_Bool detectFlag;
uint8_t masterRecv[5];
uint8_t masterWay;

_Bool runFlag = 0;

void lineTraceTask(void)
{
	getIR();
	traceLine();
}

void rfidTask(void)
{
//	nfcSearch();
}

void communicateTask(void)
{
	
}

void detectTask(void)
{
	
}

void carTask(void)
{
	HAL_UART_Receive(&huart1, masterRecv, 1, HAL_MAX_DELAY);
	masterWay = masterRecv[0] - '0';
	currentStuff = stuff[masterWay];
	runFlag = 1;
	while(runFlag)
	{
		if(!detectFlag)
		{
			lineTraceTask();
		}
	}
}
